package com.qingchuan.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author m17610881257@163.com
 * @version : GraphType.java, v 0.1 2022-05-25 00:00 m17610881257@163.com Exp $$
 * @Description 基本图形枚举类
 */
@Getter
@AllArgsConstructor
public enum GraphTypeEnum {

    CIRCLE(0, "circleStrategy", "圆形"),
    TRIANGLE(1, "triangleStrategy", "三角形"),
    SQUARE(2, "squareStrategy", "正方形"),
    DIAMOND(3, "diamondStrategy", "菱形");

    private Integer graphCode;

    private String graphBeanName;

    private String graphName;

    public static String getBeanNameByCode(Integer code) {
        String beanName = null;
        for (GraphTypeEnum item : GraphTypeEnum.values()) {
            if (item.getGraphCode().equals(code)) {
                beanName = item.getGraphBeanName();
                break;
            }
        }
        return beanName;
    }

    public static String getGraphNameByCode(Integer code) {
        String graphName = null;
        for (GraphTypeEnum item : GraphTypeEnum.values()) {
            if (item.getGraphCode().equals(code)) {
                graphName = item.getGraphName();
                break;
            }
        }
        return graphName;
    }
}
